# -*- coding:utf-8 -*-
import socket
import threading
from time import ctime

BUFSIZE = 1024

def send_msg(s):
	while True:
		data = raw_input('client:>>') 
		if not data:
			break
		s.sendall('%s\r\n'% data)			
	s.close()

s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(('127.0.0.1',8888))

t1=threading.Thread(target=send_msg,args=(s,))
t1.setDaemon(True)
t1.start()

while True:
	data=s.recv(BUFSIZE)
	if not data:
		break
	print "[%s]-%s"%(ctime(),data.strip())
s.colse()